Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hebcal/leyning

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hebcal/leyning

Javascript Torah Reading API for Parashat HaShavua and holidays

  • 2.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
488
increased by80.07%
Maintainers
1
Weekly downloads
 
Created
Source

hebcal-leyning

Javascript Torah Reading API for Parashat HaShavua and holidays

Installation

$ npm install @hebcal/leyning

Synopsis

import {HebrewCalendar, HDate, Event} from '@hebcal/core';
import leyning from '@hebcal/leyning';

const options = {sedrot: true, noHolidays: true};
const events = HebrewCalendar.calendar(options);
const ev = events.find((ev) => ev.getDesc() == 'Parashat Pinchas');
const reading = leyning.getLeyningForParshaHaShavua(ev);
console.log(`${ev.getDesc()}: ${reading.summary}`);
console.log(`Haftara: ${reading.haftara}`);
for (const [num, aliyah] of Object.entries(reading.fullkriyah)) {
  const number = num == 'M' ? 'maftir' : `aliyah ${num}`;
  let str = leyning.formatAliyahWithBook(aliyah);
  if (reading.reason[num]) {
      str += ' | ' + reading.reason[num];
  }
  console.log(`${number}: ${str}`);
}
const triReading = triennial.getTriennialForParshaHaShavua(ev);
for (const [num, aliyah] of Object.entries(triReading)) {
  const number = num == 'M' ? 'maftir' : `aliyah ${num}`;
  const str = leyning.formatAliyahWithBook(aliyah);
  console.log(`Triennial ${number}: ${str}`);
}

Classes

Triennial

Triennial Torah readings

Constants

leyning

Main interface to hebcal/leyning

Functions

getLeyningKeyForEvent(e, [il])string

Based on the event date, type and title, finds the relevant leyning key

getLeyningForHoliday(e, [il])Leyning

Looks up leyning for a given holiday name. Name should be an (untranslated) string used in holiday-readons.json. Returns some of full kriyah aliyot, special Maftir, special Haftarah

parshaToString(parsha)string

Formats parsha as a string

getHaftaraKey(parsha)string

on doubled parshiot, read only the second Haftarah except for Nitzavim-Vayelech

getChanukahShabbatKey(e, key)string
getHolidayEvents(hd, il)Array.<Event>

Filters out Rosh Chodesh and events that don't occur in this location

getLeyningForParshaHaShavua(e, [il])Leyning

Looks up leyning for a regular Shabbat parsha.

formatAliyahWithBook(a)string

Formats an aliyah object like "Numbers 28:9 - 28:15"

getDoubledName(id)string

takes a 0-based (Bereshit=0) parsha ID

getTriennial(year)Triennial

Calculates the 3-year readings for a given year

Typedefs

Aliyah : Object

Represents an aliyah

Leyning : Object

Leyning for a parsha hashavua or holiday

Triennial

Triennial Torah readings

Kind: global class

new Triennial([hebrewYear])

Builds a Triennial object

ParamTypeDescription
[hebrewYear]numberHebrew Year (default current year)

triennial.getReadings() ⇒ Object

Kind: instance method of Triennial

triennial.getStartYear() ⇒ number

Kind: instance method of Triennial

triennial.getLeyningForParshaHaShavua(ev) ⇒ Aliyah

Looks up the leyning for this Parashat HaShavua

Kind: instance method of Triennial

ParamType
evEvent

triennial.getThreeYearPattern(id) ⇒ string

First, determine if a doubled parsha is read [T]ogether or [S]eparately in each of the 3 years. Yields a pattern like 'SSS', 'STS', 'TTT', 'TTS'.

Kind: instance method of Triennial

ParamType
idnumber

triennial.cycleReadings(cycleOption) ⇒ Map.<string, Array.<Object>>

Builds a lookup table readings["Bereshit"][0], readings["Matot-Masei"][2]

Kind: instance method of Triennial

ParamType
cycleOptionObject

triennial.cycleReadingsForYear(option, readings, yr)

Kind: instance method of Triennial

ParamType
optionstring
readingsMap.<string, Array.<Object>>
yrnumber

Triennial.getYearNumber(year) ⇒ number

Returns triennial year 1, 2 or 3 based on this Hebrew year

Kind: static method of Triennial

ParamTypeDescription
yearnumberHebrew year

Triennial.getCycleStartYear(year) ⇒ number

Returns Hebrew year that this 3-year triennial cycle began

Kind: static method of Triennial

ParamTypeDescription
yearnumberHebrew year

Triennial.getTriennialAliyot() ⇒ Object

Walks parshiyotObj and builds lookup table for triennial aliyot

Kind: static method of Triennial

Triennial.resolveSameAs(parsha, book, triennial) ⇒ Object

Transforms input JSON with sameAs shortcuts like "D.2":"A.3" to actual aliyot objects for a given variation/year

Kind: static method of Triennial

ParamType
parshastring
bookstring
triennialObject

leyning

Main interface to hebcal/leyning

Kind: global constant

getLeyningKeyForEvent(e, [il]) ⇒ string

Based on the event date, type and title, finds the relevant leyning key

Kind: global function
Returns: string - key to look up in holiday-reading.json

ParamTypeDescription
eEventevent
[il]booleantrue if Israel holiday scheme

getLeyningForHoliday(e, [il]) ⇒ Leyning

Looks up leyning for a given holiday name. Name should be an (untranslated) string used in holiday-readons.json. Returns some of full kriyah aliyot, special Maftir, special Haftarah

Kind: global function
Returns: Leyning - map of aliyot

ParamTypeDescription
eEventthe Hebcal event associated with this leyning
[il]booleantrue if Israel holiday scheme

parshaToString(parsha) ⇒ string

Formats parsha as a string

Kind: global function

ParamType
parshaArray.<string>

getHaftaraKey(parsha) ⇒ string

on doubled parshiot, read only the second Haftarah except for Nitzavim-Vayelech

Kind: global function

ParamType
parshaArray.<string>

getChanukahShabbatKey(e, key) ⇒ string

Kind: global function

ParamType
eEvent
keystring

getHolidayEvents(hd, il) ⇒ Array.<Event>

Filters out Rosh Chodesh and events that don't occur in this location

Kind: global function

ParamTypeDescription
hdHDateHebrew date
ilbooleanin Israel

getLeyningForParshaHaShavua(e, [il]) ⇒ Leyning

Looks up leyning for a regular Shabbat parsha.

Kind: global function
Returns: Leyning - map of aliyot

ParamTypeDescription
eEventthe Hebcal event associated with this leyning
[il]booleanin Israel

formatAliyahWithBook(a) ⇒ string

Formats an aliyah object like "Numbers 28:9 - 28:15"

Kind: global function

ParamTypeDescription
aAliyahaliyah

getDoubledName(id) ⇒ string

takes a 0-based (Bereshit=0) parsha ID

Kind: global function

ParamType
idnumber

getTriennial(year) ⇒ Triennial

Calculates the 3-year readings for a given year

Kind: global function

ParamTypeDescription
yearnumberHebrew year

Aliyah : Object

Represents an aliyah

Kind: global typedef
Properties

NameTypeDescription
kstringBook (e.g. "Numbers")
bstringbeginning verse (e.g. "28:9")
estringending verse (e.g. "28:15")
[v]numbernumber of verses
[p]numberparsha number (1=Bereshit, 54=Vezot HaBracha)

Leyning : Object

Leyning for a parsha hashavua or holiday

Kind: global typedef
Properties

NameTypeDescription
summarystring
haftarastringHaftarah
sephardicstringHaftarah for Sephardic
fullkriyahObject.<string, Aliyah>
[reason]Object

Keywords

FAQs

Package last updated on 19 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc